
local lcf = ffi.C

local o = {}

http = o

function o.get(ip, port, path)
	print("GET:",ip, port, path)

	local c = gx_uni_call(1, ip, port)
	if nil==c then
		return nil
	end

	local req = string.format("GET %s HTTP/1.1\r\nHost: %s:%d\r\n\r\n", path, ip, port)
	local res,r2 = gx_uni_call(2, c, req)
	print(res)
	print(r2)

	lcf.gx_close(c);	-- connection close with request
	return r2
end
